let version = captures.at(2).unwrap();
let url = captures.at(3).unwrap();
let version = semver::Version::parse(version).ok().expect("invalid version");
- let source_id = SourceId::from_url(url.to_string());
+ let source_id = SourceId::from_url(url);
Ok(PackageId {
inner: Arc::new(PackageIdInner {
/// use cargo::core::SourceId;
/// SourceId::from_url("git+https://github.com/alexcrichton/\
/// libssh2-static-sys#80e71a3021618eb05\
- /// 656c58fb7c5ef5f12bc747f".to_string());
+ /// 656c58fb7c5ef5f12bc747f");
/// ```
- pub fn from_url(string: String) -> SourceId {
+ pub fn from_url(string: &str) -> SourceId {
let mut parts = string.splitn(2, '+');
let kind = parts.next().unwrap();
let url = parts.next().unwrap();
impl Decodable for SourceId {
fn decode<D: Decoder>(d: &mut D) -> Result<SourceId, D::Error> {
let string: String = Decodable::decode(d).ok().expect("Invalid encoded SourceId");
- Ok(SourceId::from_url(string))
+ Ok(SourceId::from_url(&string))
}
}